﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SelectReceiver.aspx.cs" Inherits="Customer_SelectReceiver"  MasterPageFile="../SelectMasterPage.master"  %>
<%@ OutputCache Duration="2" SqlDependency="CIM.Net:Dat_Stock" VaryByParam="none" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="Common" %>
<%@ Import Namespace="DAL" %>

<%@ Register src="../common/Pager.ascx" tagname="Pager" tagprefix="uc2" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
    function returnval(addtype) {

        var cklist = document.getElementsByName("UserInfo"); 
        
        var ischecked = false;
        for (var i = 0; i < cklist.length; i++) {
            if (cklist[i].checked == true)
            { ischecked = true; break; }
        }

        if (!ischecked)
            alert("请选择接收人！");
        else {
            var idlist = "";
            var namelist = "";
            if (addtype == 1) {
                for (var i = 0; i < cklist.length; i++) {
                    if (cklist[i].checked) {
                        
                        idlist = idlist + cklist[i].value.split('$')[0] + ",";
                        namelist = namelist + cklist[i].value.split('$')[1] + ",";
                                        }

                }
                if (idlist != "") idlist = idlist.substr(0, idlist.length - 1);
                if (namelist != "") namelist = namelist.substr(0, namelist.length - 1);
                
                parent.$("#" + "<%= ParentID %>").val(namelist);
                parent.$("#" + "<%= ParentID1 %>").val(idlist);
                parent.tb_remove();
            }
            else {
               
            }
            
        }
    }
</script>

    <table cellpadding="0" cellspacing="2" width="100%" border="0">
	<tr>
		<td width="100%">
		<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
			<tr>
		        <td class="leftTd"  valign="top">
		        <table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
		        	<tr>
		            	<td class="titleStyle">选择用户</td>
		            </tr>
		        </table>
		         <br />
		          <table width="98%" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#000066">
	                <tr>
		                <td style="height: 30px;" class="banma22_1">&nbsp;真实姓名：<asp:TextBox ID="RealName" 
                                runat="server" Width="60px" CssClass="face"></asp:TextBox>&nbsp;&nbsp;关键字：<asp:TextBox ID="Keyword" runat="server" Width="60px" CssClass="face"></asp:TextBox>&nbsp;&nbsp;
	                        &nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:Button ID="submit" runat="server" Text=" 搜 索 " CssClass="button" 
                                onclick="submit_Click" />
		                </td>
	                </tr>
                    </table><br/>
                    <table width="98%" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#000066">
	                <tr>
		                <td style="height: 30px;" class="banma22_1" align="center">
                             <input type="button" class="button" value="选择"  onclick="returnval(1)" />
		                </td>
	                </tr>
                    </table><br/>
                    <asp:ListView ID="lv_User" runat="server" DataKeyNames="UserKey" >
                       <LayoutTemplate>
                            <table id="table1"  runat="server" width="98%" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#000066">
                              <tr>
                                <td style="height: 25px; width: 5%;" class="banma1 TextCenters">选择</td>
                                <td style="height: 25px; width: 5%;" class="banma1 TextCenters">序号</td>
                                <td style="height: 25px; width: 10%;" class="banma1 TextCenters">用户类型</td>
                                <td style="height: 25px; width: 10%;" class="banma1 TextCenters">用户名</td>
                                <td style="height: 25px; width: 15%;" class="banma1 TextCenters">所在公司</td>
		                        <td style="height: 25px; width: 10%;" class="banma1 TextCenters">真实姓名</td>
	                          </tr>
                              <tr id="itemPlaceholder" runat="server" ></tr><br />
                            </table>
                       </LayoutTemplate>
                       <ItemTemplate>
                           <tr>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><input name="UserInfo" type="checkbox" id="UserKey" value='<%# Eval("UserKey").ToString()+"$"+Eval("RealName").ToString() %>' /></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Container.DataItemIndex+1 %></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Account.GetAccountType(Eval("UserType"))%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("Account")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("CompanyName")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("RealName")%></td>
	                       </tr> 
                      </ItemTemplate>
                       <AlternatingItemTemplate>
                           <tr>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><input name="UserInfo" type="checkbox" id="UserKey" value='<%# Eval("UserKey").ToString()+"$"+Eval("RealName").ToString() %>' /></td></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Container.DataItemIndex+1 %></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Account.GetAccountType(Eval("UserType"))%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("Account")%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("CompanyName")%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("RealName")%></td>
	                       </tr> 
                      </AlternatingItemTemplate>
                      
	                  </asp:ListView>
        </td>
    </tr>
</table>
</asp:Content>
